{{template "../public/page_header.html" .}}
<script type="text/javascript" src="/static/backend/js/jqPaginator.js"></script>

    <div class="panel panel-default">              
        <div class="panel-heading">
            <a href="/{{config "String" "adminPath" ""}}/menu/add" class="btn btn-primary">增加导航</a>
        </div>
        <div class="table-responsive">
            <table class="table table-bordered">
                <thead>
                    <tr class="th">
                        <th>导航名称</th>
                        <th>关联商品</th>
                        <th>跳转地址</th>
                        <th>导航位置</th>
                        <th class="text-center">排序</th>
                        <th class="text-center">状态</th>
                        <th class="text-center">操作</th>
                    </tr>
                </thead>
                <tbody>
                    {{range $key,$value := .menuList}}
                    <tr>
                        <td>{{$value.Title}}</td>
                        <td>{{$value.Relation}}</td>
                        <td>{{$value.Link}}</td>
                        <td>
                            {{if eq $value.Position 1}}
                                顶部
                            {{else if  eq $value.Position 2}}
                                中间
                            {{else if eq $value.Position 3}}
                                底部
                            {{end}}
                        </td>
                        <td class="text-center">
                            <span class="chSpanNum" data-id="{{$value.Id}}" data-table="menu" data-field="sort" data-num="{{$value.Sort}}">{{$value.Sort}}</span>
                        </td>
                        <td align="center">
                           {{if eq $value.Status 1}}                              
                                <img src="/static/backend/images/yes.gif"  class="chStatus" data-id="{{$value.Id}}" data-table="menu" data-field="status" />
                           {{else}}
                                <img src="/static/backend/images/no.gif"  class="chStatus" data-id="{{$value.Id}}" data-table="menu" data-field="status" />
                           {{end}}
                        </td>                            
                        <td class="text-center">
                            <a href="/{{config "String" "adminPath" ""}}/menu/edit?id={{$value.Id}}" />修改</a> 　
                            <a class="delete" href="/{{config "String" "adminPath" ""}}/menu/delete?id={{$value.Id}}" />删除</a>
                        </td>
                    </tr>
                    {{end}}
                </tbody>
            </table>
        </div>
        <div id="pagination" class="pagination fr">
        </div>
    </div>
    <script>
        $(function(){
            $('#pagination').jqPaginator({
                totalPages: {{.totalPages}},
                visiblePages: 10,
                currentPage: {{.page}},
                onPageChange: function (num, type) {
                   console.log(num,type)
                   if(type=="change"){
                        location.href="/{{config "String" "adminPath" ""}}/menu?page="+num;
                   }
                }
            });
        })
    </script>
</body>
</html>